package test.core;
import java.text.SimpleDateFormat;
import java.time.Clock;
import java.time.Instant;
import java.util.Date;
import org.junit.Test;
import hyl.core.MyDate;
import hyl.core.MyFun;
public class MyDatetest {
	@Test
	public void test() {		
		System.out.println(MyFun.str2Time("8")); 
		System.out.println(MyFun.str2Time("8:9")); 
		System.out.println(MyFun.str2Time("8:9:10")); 
	}
	//@Test
	public void test2() {
//	  Date stamp= new Date();
//		System.out.println(stamp); 
//		System.out.println(MyFun.str2Date("12:24")); 
//		System.out.println(MyFun.str2Date("12:40:24")); 
//		
//		System.out.println(MyFun.str2Date("2019-11")); 
//		System.out.println(MyFun.str2Date("2019-11-03")); 		
//		System.out.println(MyFun.str2Date("2019-11-13 12")); 
//		System.out.println(MyFun.str2Date("2019-11-03 12:24")); 
//		System.out.println(MyFun.str2Date("2019-11-13 12:40:24")); 
//		System.out.println(MyFun.str2Date("18")); 
//		System.out.println(MyFun.str2Date("2019")); 
//		System.out.println(MyFun.str2Date("201902")); 
//		System.out.println(MyFun.str2Date("20190203")); 
//		System.out.println(MyFun.str2Date("2019020312")); 
//		System.out.println(MyFun.str2Date("201902031323")); 
//		System.out.println(MyFun.str2Date("20190203145624")); 
		// System.out.println(MyFun.date2Str(MyFun.addDays( 3)) );
		System.out.println(System.currentTimeMillis());
		System.out.println(Clock.systemUTC().millis());
		System.out.println(Instant.now().toEpochMilli());
		// LocalDateTime.now().toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
		Date D基准日 = MyFun.str2Date("2019-7-29");
		Date d2 = MyFun.str2Date("2019-8-12");// MyDate.getYesterday()
		int w = MyDate.getWeekNumOfT2_T1(D基准日, d2);
		System.out.println(w);
		SimpleDateFormat myFmt = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
		SimpleDateFormat myFmt1 = new SimpleDateFormat("yy/MM/dd HH:mm");
		SimpleDateFormat myFmt2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 等价于now.toLocaleString()
		SimpleDateFormat myFmt3 = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 E ");
		SimpleDateFormat myFmt4 = new SimpleDateFormat("一年中的第 D 天 一年中第w个星期 一月中第W个星期 在一天中k时 z时区");
		Date now = new Date();
		System.out.println(myFmt.format(now));
		System.out.println(myFmt1.format(now));
		System.out.println(myFmt2.format(now));
		System.out.println(myFmt3.format(now));
		System.out.println(myFmt4.format(now));
		System.out.println(now.toGMTString());
		System.out.println(now.toLocaleString());
		System.out.println(now.toString());
	}
}
